package com.huage_05.lesson_04;

import java.util.Calendar;

/*
    测试类
 */
public class CalenderDemo {
    public static void main(String[] args) {
        Calendar c = Calendar.getInstance();
//        System.out.println(c);
        int year = c.get(Calendar.YEAR);
        int month = c.get(Calendar.MONTH)+1;
        int date = c.get(Calendar.DATE);
        System.out.println(year+"年"+month+"月"+date+"日");
        System.out.println("--------");

        c.add(Calendar.YEAR,-3);
        c.add(Calendar.MONTH,6);
        c.add(Calendar.DATE,7);
        int year1 = c.get(Calendar.YEAR);
        int month1 = c.get(Calendar.MONTH)+1;
        int date1 = c.get(Calendar.DATE);
        System.out.println(year1+"年"+month1+"月"+date1+"日");
        System.out.println("--------");

        c.set(2028,11,20);
        int year2 = c.get(Calendar.YEAR);
        int month2 = c.get(Calendar.MONTH)+1;
        int date2 = c.get(Calendar.DATE);
        System.out.println(year2+"年"+month2+"月"+date2+"日");

    }
}
